<template>
<div class="bargain views-container">
    <div class="wlm-table">
        <div class="wlm-table-header">
            <el-form :model="tableFormatData.userTable.files" size="small" label-width="85px" class="retail-form" label-position="right">
                <el-form-item label="" class="filter">
                    <el-form-item label="操作员：">
                        <el-input @keyup.enter.native="filesSerch" v-model="tableFormatData.userTable.files.real_name" placeholder="请输入操作员" style="width:160px;"></el-input>
                    </el-form-item>
                    <el-form-item label="操作时间：">
                        <el-date-picker style="width:360px;margin-right:0;" v-model="tableFormatData.userTable.files.time" :picker-options="pickerOptions" value-format="timestamp" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="IP地址：">
                        <el-input @keyup.enter.native="filesSerch" v-model="tableFormatData.userTable.files.ip" placeholder="请输入IP地址" style="width:160px;"></el-input>
                    </el-form-item>
                       <el-form-item label="日志内容：">
                        <el-input @keyup.enter.native="filesSerch" v-model="tableFormatData.userTable.files.log_content" placeholder="请输入日志内容" style="width:300px;"></el-input>
                    </el-form-item>
                </el-form-item>
                <el-form-item label="" class="filter-btns">
                    <el-button type="primary" @click="filesSerch">筛选</el-button>
                    <el-button type="text" @click="filesEmpty">清空筛选条件</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div class="wlm-table-content">
            <el-table :ref="tableFormatData.userTable.key" :data="tableFormatData.userTable.tableData" @selection-change="handleSelectionChange" style="width: 100%">
                <el-table-column prop="date" label="ID"  min-width="40">
                    <template slot-scope="scope">
                        <span>{{scope.row.log_id}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="date" label="操作员" min-width="40">
                    <template slot-scope="scope">
                        <p>{{scope.row.real_name}}</p>
                    </template>
                </el-table-column>
                <el-table-column prop="date" label="操作时间" min-width="50">
                    <template slot-scope="scope">
                        <p>{{scope.row.create_time}}</p>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="IP地址" min-width="50">
                    <template slot-scope="scope">
                        <span>{{scope.row.log_IP}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="操作内容" >
                    <template slot-scope="scope">
                         <el-popover
                  placement="top-start"
                  width="200"
                  trigger="hover"
                  :content="scope.row.log_content">
                  <!-- <el-button >hover 激活</el-button> -->
                  <div slot="reference">{{scope.row.log_content&&(scope.row.log_content+'').length>40?(scope.row.log_content+'').substring(0,40)+'...' :scope.row.log_content}} </div>
                </el-popover>
                        <!-- <span >{{scope.row.log_content}}</span> -->
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination-content flex-row flex-justify-e flex-align-c">
                <el-pagination :disabled="!hasTableData" @size-change="listPageChange" @current-change="listPageChange" :current-page.sync="tableFormatData.userTable.pagination.page" :page-sizes="tableFormatData.userTable.pagination.pagesizes" :page-size.sync="tableFormatData.userTable.pagination.list_rows" layout="total, sizes, prev, pager, next, jumper" :total="hasTableData?tableFormatData.userTable.pagination.total : 0">
                </el-pagination>
            </div>
        </div>
    </div>
</div>
</template>

<script>
import {
  UserLogs
} from '@/api/setting'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Table')],
  name: 'Bargain',
  components: {
  },
  data() {
    return {
      blogTitle: '',
      tableFormatData: {
        current: 'userTable',
        userTable: {
          key: 'userTable',
          api: {
            getList: UserLogs
          },
          tableData: [],
          files: {
            ip: '',
            log_content:'',
            real_name: '',
            time: [],
            ids: [],
            checkall: '0',
            Recycle: '1'
          },
          pagination: {
            page: 1,
            list_rows: 50,
            pagesizes: [50, 100],
            total: 0
          }
        }
      }
    }
  },
  methods: {
  }
}
</script>
